﻿using System;
using System.Web.Caching;
using System.Collections;
using System.Collections.Generic;

namespace System.Web.Caching
{
	/// <summary>
	/// Summary description for System.Web.Caching
	/// </summary>
	public static class CacheExtensions
	{
		public static void Clear(this Cache x)
		{
			var cacheKeys = new List<string>();

			IDictionaryEnumerator cacheEnum = x.GetEnumerator();

			while (cacheEnum.MoveNext())
			{
				cacheKeys.Add(cacheEnum.Key.ToString());
			}

			foreach (string cacheKey in cacheKeys)
			{
				x.Remove(cacheKey);
			}
		}

	}
}
